import $handle from '/src/utils/handle'
import $Toast from '/static/vant/toast/toast'
import $Notify from '/static/vant/notify/notify'
import movableview from '../components/movableview'
import icons from '../components/icons'
import mCheckbox from '../components/mform/mcheckbox'
import mForm from '../components/mform'
import mField from '../components/mform/mfield'
import mPicker from '../components/mform/mpicker'
import mSelect from '../components/mform/mselect'

export default {
  install: App => {
    App.config.warnHandler = e => {
      // 禁止打印vue关于vant组件未注册的警报
      if (/$Failed to resolve component: van-/.test(e)) {
        return null
      }
      return e
    }
    // App.config.warnHandler = e => e
    App.config.globalProperties.$pclr = '#003B90' // 主题色 (国庆)
    App.config.globalProperties.$clr = '#FF7735' // 辅助色 (国庆)
    App.config.globalProperties.$Toast = $Toast
    App.config.globalProperties.$Notify = $Notify
    App.config.globalProperties.$handle = $handle

    // 注册全局组件
    App.component('movableview', movableview)
    App.component('icons', icons)
    App.component('m-checkbox', mCheckbox)
    App.component('m-form', mForm)
    App.component('m-field', mField)
    App.component('m-picker', mPicker)
    App.component('m-select', mSelect)
  }
}
